package util

import (
	"fmt"
	"reflect"
)

func CallMethod(method reflect.Value, params ...interface{}) []reflect.Value {
	in := make([]reflect.Value, len(params))
	for k, param := range params {
		in[k] = reflect.ValueOf(param)
	}
	d := method.Call(in)
	if method.IsZero() {
		fmt.Println("error callback")
		return nil
	}
	return d
}
